#include <stdio.h>
#include <stdlib.h>

int main()
{	 	   	 	 
    char chars[] = {'a', ' ', 'b', ' ', 'c', ' ', ' ', 'd'};
    char *p;

    p = chars;
    while (p < chars + (sizeof(chars) / sizeof(char)))
    {	 	   	 	 
        if (*p == ' ')
        {	 	   	 	 
            *p = '_';
        }
        p++;
    }

    printf("替换后数组为：");
    p = chars;
    while (p < chars + (sizeof(chars) / sizeof(char)))
    {	 	   	 	 
        printf("%c ", *p);
        p++;
    }

    return 0;
}	 	   	 	 
